<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 500px;
            height: 500px;
            border-bottom: 5px solid black;
            overflow: hidden;
            /* 开启BFC，解决高度塌陷的问题 */
        }
        .box1{
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background-color: orange;
            animation: ball 5s alternate infinite;
        }
        @keyframes ball{
            form{
                margin-top: 0;
                animation-timing-function: ease-in;
            }
            20%{
                margin-top: 400px;
                animation-timing-function: ease-out;
            }
            40%{
                margin-top: 100px;
                animation-timing-function: ease-in;
            }
            60%{
                margin-top: 400px;
                animation-timing-function: ease-out;
            }
            80%{
                margin-top: 250px;
                animation-timing-function: ease-in;
            }            
            to{
                margin-top: 400px;
            }
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="box1"></div>
    </div>
</body>
</html>